﻿using System;
using System.Data;
using Module.DataAccess;
using Module.EntitiesInfo;


namespace Module.BusinessLogic
{
    public class PartnerBL
    {
        public static DataTable GetAll()
        {
            try
            {
                return new PartnerDB().GetAll();
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static void Delete(int id)
        {
            try
            {
                new PartnerDB().Delete(id);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static int Insert(PartnerInfo info)
        {
            try
            {
                return new PartnerDB().Insert(info);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static void Update(PartnerInfo info)
        {
            try
            {
                new PartnerDB().Update(info);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static PartnerInfo GetInfo(int id)
        {
            try
            {
                PartnerInfo partnerInfo;
                partnerInfo = ObjectHelper.FillObject<PartnerInfo>(new PartnerDB().GetInfo(id));
                if (partnerInfo != null)
                    return partnerInfo;
                return null;
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static DataTable Search(string keysearch, DateTime starDatetime, DateTime endDatetime)
        {
            try
            {
                return new PartnerDB().Search(keysearch, starDatetime, endDatetime);
            }
            catch (Exception ex)
            {
                throw;
            }

        }
    }
}

